﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.IO;
using CGeers.Wcf.Services.Preprocesslanguage;
namespace CGeers.Wcf.Services
{
    public class DemoServer : IFileUploadService
    {
        Ngram ng=new Ngram();
        NgramN ngn = new NgramN();
        ProcessPragraph pp;

        public DemoServer()
        {
            ng.AllowDelCount = true;
            ng.CountDel = 5;
            pp = new ProcessPragraph(ngn,ng);
            ProcessPragraph.IsWordLinked = false;
            ProcessPragraph.IsNgramNew = false;
        }

        public string convertToSigned(string str)
        {
            return pp.process(str);
        }
        public string getWord(string w)
        {
            string wordArr=w;
            w = Utils.processUtils.ConvertToUnSign(w);
            if(Ngram.P1.ContainsKey(w))
            {
                wordArr = "";
                foreach (KeyValuePair<string,double> pair in Ngram.P1[w])
	            {
		            wordArr+=pair.Key+":";
	            }
                wordArr = wordArr.Remove(wordArr.Length - 1);
            }
            return wordArr;
        }
    }
}
